//根据输入的日期，计算是这一年的第几天。输入保证年份为4位数且日期合法。
//输入描述：输入一行，每行空格分割，分别是年，月，日。
//输出描述：输出是这一年的第几天
//注意闰年考虑
//	1	  2	    3    4	 5	 6	 7	 8	 9	  10	11	 12
//  31  29/28	31  30  31   30  31  31  30   31    30   31
//  1    -1/-2  +1   0   +1  0   +1  +1   0   +1     0    +1 
#pragma warning(disable:4996)
#include<stdio.h>
int Find_Leap_Year(int year)
{
	if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
		return 1;
	return 0;
}
int main()
{
	int year, month, day, total_day;
	total_day = 0;
	int month_day[] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
	scanf("%d %d %d", &year, &month, &day);
	
	for (int i = 1; i < month; i++) {
		total_day += month_day[i];
	}
	if (Find_Leap_Year(year) && month >= 3) {
		day += 1;
	}
	total_day += day;
	printf("%d", total_day);
		return 0;
}
